import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'

Vue.use(VueRouter)

const routes = [
    {
        path: '/',
        name: 'home',
        component: HomeView,
        children: [
            {
                path: '/imgDetail', name: 'imgDetail',
                component: () => import('@/components/item/imgDetail.vue')
            },
        ]
    },
    {
        path: '/footer',
        name: 'footer',
        component: () => import('@/components/footer.vue')
    },
    {
        path: '/shop',
        name: 'shop',
        component: () => import('@/views/shop/shop.vue'),
        children: [{
            path: '/item',
            name: 'item',
            component: () => import('@/components/item/item.vue')

        }, {
            path: '/itemRecommend',
            name: 'itemRecommend',
            component: () => import('@/components/item/itemRecommend.vue')

        }, {
            path: '/addToCart',
            name: 'addToCart',
            component: () => import('@/components/item/addToCart.vue')

        }]
    },
    {
        path: '/knowledge',
        name: 'knowledge',
        component: () => import('@/views/knowledge/knowledge.vue')
    }, {
        path: '/cart',
        name: 'cart',
        component: () => import('@/views/cart/cart.vue')
    },
    {
        path: '/contract',
        name: 'contract',
        component: () => import('@/views/contract/contract.vue')
    },
    {
        path: '/login',
        name: 'login',
        component: () => import('@/views/login/login.vue')
    }
]

const router = new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    routes,
})

export default router
